package com.controller;

import com.pojo.Product;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class ProductController {
    @RequestMapping("/getProducts")
    public void getProducts(String[] proIds) {
        for (String proId : proIds) {
            System.out.println("获取到的ID为"+proId+"的商品");
        }
    }
    @RequestMapping("/getProduct")
    public void getn(@RequestBody Product product){
        String proid =product.getProId();
        String proName =product.getProName();
        System.out.println("获取到了id为"+proid+"名称为"+proName+"的商品");
    }
    @RequestMapping("/getProductList")
    public void getProductList(@RequestBody List<Product> productList){
        for (Product product:productList){
            String proid =product.getProId();
            String proName =product.getProName();
            System.out.println("获取到了id为"+proid+"名称为"+proName+"的商品");

        }
    }
}

